home *** CD-ROM | disk | FTP | other *** search
/ Software 2000 / Software 2000 Volume 1 (Disc 1 of 2).iso / utilities / u620.dms / in.adf / Tips&Tricks / DOS-Intuition / dos2win.c < prev    next >
Encoding:
C/C++ Source or Header  |  1992-04-30  |  1.1 KB  |  52 lines

  1.  
  2. #include <stdio.h>
  3. #include <exec/memory.h>
  4. #include <dos/dos.h>
  5. #include <intuition/intuition.h>
  6. #include <clib/exec_protos.h>
  7. #include <clib/intuition_protos.h>
  8.  
  9.  
  10. #define INTUINAME (UBYTE *)"intuition.library"
  11. #define VERSION 37
  12. #define MAXLEN 80
  13. #define TEXT (UBYTE *)"Detta är en text skriven via AmigaDOS...\nI ett Intuition-fönster"
  14. #define ERRTEXT (UBYTE *)"Hmm, du kör inte AmigaOS 2.0 va?\n"
  15.  
  16. struct IntuitionBase *IntuitionBase;
  17.  
  18.  
  19. int main(void)
  20. {
  21.  struct Window *win;
  22.  char conName[MAXLEN];
  23.  BPTR fh;
  24.  
  25.  
  26.  IntuitionBase = (struct IntuitionBase *)OpenLibrary(INTUINAME,VERSION);
  27.  if(IntuitionBase) {
  28.     win = OpenWindowTags(NULL,
  29.                              WA_Left,10,
  30.                      WA_Top, 10,
  31.                   WA_Width, 400,
  32.                  WA_Height, 100,
  33.                  WA_DragBar,TRUE,
  34.                  WA_DepthGadget,TRUE,
  35.                  WA_SimpleRefresh,TRUE,
  36.                  TAG_DONE);
  37.      if(win) {
  38.         sprintf(conName,"CON://///Footitel/WINDOW%lx",win);
  39.         fh = Open(conName,MODE_OLDFILE);
  40.         if(fh) {
  41.             Write(fh,TEXT,strlen(TEXT));
  42.             Delay(150);
  43.             Close(fh);
  44.         }
  45.         else
  46.             CloseWindow(win);
  47.     }
  48.     CloseLibrary((struct Library *)IntuitionBase);
  49.  }
  50.  else
  51.     Write(Output(),ERRTEXT,strlen(ERRTEXT));
  52. }